package com.tutorial.transactional;

import com.tutorial.transactional.config.SpringConfig;
import com.tutorial.transactional.service.IAccountService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.math.BigDecimal;

public class AccountTest {
    public static void main(String[] args) {
        // xml文件配置方式
        // ApplicationContext app = new ClassPathXmlApplicationContext("ApplicationContext.xml");
        // 注解方式
        ApplicationContext app = new AnnotationConfigApplicationContext(SpringConfig.class);
        IAccountService accountService = app.getBean(IAccountService.class);
        accountService.transferMoney("tom", "Lucy", BigDecimal.valueOf(500));
    }
}
